package com.dtx.qiku.goods.dao.impl;


import com.dtx.qiku.goods.dao.UserDao;
import com.dtx.qiku.goods.entity.User;
import com.dtx.qiku.store.FileStoreUtils;


import java.io.IOException;

public class UserDaoImpl implements UserDao {

    private final String TABLE_NAME = "user";

    @Override
    public User findUserByUserName(String userName) throws IOException {
        return FileStoreUtils.selectOne(TABLE_NAME, u -> userName.equalsIgnoreCase(u.getUserName()),User.class);
    }

    @Override
    public int saveUser(User user) throws IOException {
        return FileStoreUtils.insert(TABLE_NAME,user,User.class);
    }
}
